package com.xsp.controller;

import com.xsp.entity.BookInfo;
import com.xsp.entity.CommonResult;
import com.xsp.service.BookService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author xsp
 * @date 2024/3/9
 * @desc
 */
@RestController
@RequestMapping("book")
public class BookController {
    @Resource
    private BookService bookService;

    @RequestMapping("list/{bookName}")
    public CommonResult list(@PathVariable("bookName") String bookName) {
        List<BookInfo> bookInfos = bookService.find(bookName);
        return CommonResult.success(bookInfos, "查询成功");
    }
}
